package org.example.cake.service;

import org.apache.ibatis.annotations.Param;
import org.example.cake.entity.Userdiscount;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public interface UserdiscountService{


    int deleteByPrimaryKey(Integer userdiscount);

    int insert(Userdiscount record);

    int insertSelective(Userdiscount record);

    Userdiscount selectByPrimaryKey(Integer userdiscount);

    int updateByPrimaryKeySelective(Userdiscount record);

    int updateByPrimaryKey(Userdiscount record);


    /**
     * 根据用户id查询此用户有多少张优惠券
     * @param userid 用户id
     * @return 返回的个数
     */
    public int countByuserid(@Param("userid") Integer userid);
    /**
     * 删除优惠券
     * @Date 2025-08-04 谭丽那
     * @param userdiscount 用户连接优惠券
     * @return
     */
    Integer deldis(Userdiscount userdiscount);

    /**
     * 批量新增优惠券
     * @param userdiscounts 用户优惠券对象
     */
    public void batchInsertDiscount(@Param("userdiscounts") List<Userdiscount> userdiscounts);

    /**
     * 判断该用户是否拥有此优惠券 避免重复领取
     * @param userdiscount
     * @return
     */
    Integer getUsercountifTrue(Userdiscount userdiscount);

    /**
     * 新增用户优惠券
     * @param userdiscount
     * @return
     */
    Integer addfestOne(Userdiscount userdiscount);
}
